home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / utility1 / gs261src.zip / GP.H < prev    next >
C/C++ Source or Header  |  1993-05-13  |  7KB  |  172 lines

  1. /* Copyright (C) 1991, 1992, 1993 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* gp.h */
  20. /* Interface to platform-specific routines for Ghostscript */
  21.  
  22. /*
  23.  * This file defines ***ALL*** the routines that are Ghostscript- and
  24.  * platform-specific.  The routines are implemented in a gp_*.c file
  25.  * specific to each platform.  We try very hard to keep this list short!
  26.  */
  27.  
  28. /* ------ Initialization/termination ------ */
  29.  
  30. /*
  31.  * This routine is called early in the Ghostscript initialization.
  32.  * It should do as little as possible.  In particular, it should not
  33.  * do things like open display connections: that is the responsibility
  34.  * of the display device driver.
  35.  */
  36. extern void gp_init(P0());
  37.  
  38. /*
  39.  * This routine is called just before Ghostscript exits (normally or
  40.  * abnormally).  It too should do as little as possible.
  41.  */
  42. extern void gp_exit(P2(int exit_status, int code));
  43.  
  44. /* ------ Date and time ------ */
  45.  
  46. /*
  47.  * Read the current date (in days since Jan. 1, 1980) into pdt[0],
  48.  * and time (in milliseconds since midnight) into pdt[1].
  49.  */
  50. extern void gp_get_clock(P1(long *pdt));
  51.  
  52. /* ------ Screen management ------ */
  53.  
  54. /*
  55.  * These routines are only relevant in a single-window environment
  56.  * such as a PC; on platforms with window systems, the 'make current'
  57.  * routines do nothing.
  58.  */
  59.  
  60. #ifndef gx_device_DEFINED
  61. #  define gx_device_DEFINED
  62. typedef struct gx_device_s gx_device;
  63. #endif
  64.  
  65. /* Initialize the console. */
  66. extern void gp_init_console(P0());
  67.  
  68. /* Write a string to the console. */
  69. extern void gp_console_puts(P2(const char *, uint));
  70.  
  71. /* Make the console current on the screen. */
  72. extern int gp_make_console_current(P1(gx_device *));
  73.  
  74. /* Make the graphics current on the screen. */
  75. extern int gp_make_graphics_current(P1(gx_device *));
  76.  
  77. /* ------ Printer accessing ------ */
  78.  
  79. /*
  80.  * Open a connection to a printer.  A null file name means use the
  81.  * standard printer connected to the machine, if any.
  82.  * If possible, support "|command" for opening an output pipe.
  83.  * Return NULL if the connection could not be opened.
  84.  */
  85. extern FILE *gp_open_printer(P2(char *fname, int binary_mode));
  86.  
  87. /* Close the connection to the printer. */
  88. extern void gp_close_printer(P2(FILE *pfile, const char *fname));
  89.  
  90. /* ------ File names ------ */
  91.  
  92. /* Define the character used for separating file names in a list. */
  93. extern const char gp_file_name_list_separator;
  94.  
  95. /* Define the default scratch file name prefix. */
  96. extern const char gp_scratch_file_name_prefix[];
  97.  
  98. /* Define the string to be concatenated with the file mode */
  99. /* for opening files without end-of-line conversion. */
  100. /* This is always either "" or "b". */
  101. extern const char gp_fmode_binary_suffix[];
  102. /* Define the file modes for binary reading or writing. */
  103. /* (This is just a convenience: they are "r" or "w" + the suffix.) */
  104. extern const char gp_fmode_rb[];
  105. extern const char gp_fmode_wb[];
  106.  
  107. /* Create and open a scratch file with a given name prefix. */
  108. /* Write the actual file name at fname. */
  109. extern FILE *gp_open_scratch_file(P3(const char *prefix, char *fname,
  110.                      const char *mode));
  111.  
  112. /* Answer whether a file name contains a directory/device specification, */
  113. /* i.e. is absolute (not directory- or device-relative). */
  114. extern int gp_file_name_is_absolute(P2(const char *fname, uint len));
  115.  
  116. /* Answer the string to be used for combining a directory/device prefix */
  117. /* with a base file name.  The file name is known to not be absolute. */
  118. extern const char *
  119.     gp_file_name_concat_string(P4(const char *prefix, uint plen,
  120.                       const char *fname, uint len));
  121.  
  122. /* ------ File operations ------ */
  123.  
  124. /* If the file given by fname exists, fill in its status and return 1; */
  125. /* otherwise return 0. */
  126. typedef struct file_status_s {
  127.     long size_pages;
  128.     long size_bytes;
  129.     long time_referenced;
  130.     long time_created;
  131. } file_status;
  132. extern int gp_file_status(P2(const char *fname, file_status *pstatus));
  133.  
  134. /* ------ File enumeration ------ */
  135.  
  136. #ifndef file_enum_DEFINED        /* also defined in filedev.h */
  137. #  define file_enum_DEFINED
  138. struct file_enum_s;    /* opaque to client, defined by implementor */
  139. typedef struct file_enum_s file_enum;
  140. #endif
  141.  
  142. /*
  143.  * Begin an enumeration.  pat is a C string that may contain *s or ?s.
  144.  * The implementor should copy the string to a safe place.
  145.  * If the operating system doesn't support correct, arbitrarily placed
  146.  * *s and ?s, the implementation should modify the string so that it
  147.  * will return a conservative superset of the request, and then use
  148.  * the string_match procedure to select the desired subset.  E.g., if the
  149.  * OS doesn't implement ? (single-character wild card), any consecutive
  150.  * string of ?s should be interpreted as *.  Note that \ can appear in
  151.  * the pattern also, as a quoting character.
  152.  */
  153. extern file_enum *gp_enumerate_files_init(P3(const char *pat, uint patlen,
  154.                          const gs_memory_procs *mprocs));
  155.  
  156. /*
  157.  * Return the next file name in the enumeration.  The client passes in
  158.  * a scratch string and a max length.  If the name of the next file fits,
  159.  * the procedure returns the length.  If it doesn't fit, the procedure
  160.  * returns max length +1.  If there are no more files, the procedure
  161.  * returns -1.
  162.  */
  163. extern uint gp_enumerate_files_next(P3(file_enum *pfen, char *ptr, uint maxlen));
  164.  
  165. /*
  166.  * Clean up a file enumeration.  This is only called to abandon
  167.  * an enumeration partway through: ...next should do it if there are
  168.  * no more files to enumerate.  This should deallocate the file_enum
  169.  * structure and any subsidiary structures, strings, buffers, etc.
  170.  */
  171. extern void gp_enumerate_files_close(P1(file_enum *pfen));
  172.